import React, {Component} from 'react';
import {RefreshControl, ScrollView, View} from 'react-native';
import {Tabs} from '@ant-design/react-native';
import ListContent from "./ListContent";

const conent = ""

class RenderContent extends Component {
    constructor(props) {
        super(props);
        this.state = {
            refreshing: false,
        };
    }

    render() {
        const {tab, index} = this.props
        return (
            <ScrollView
                style={{backgroundColor: '#fff'}}
                refreshControl={
                    <RefreshControl
                        refreshing={this.state.refreshing}
                        onRefresh={() => {
                            this.setState({refreshing: true});
                            setTimeout(() => {
                                this.setState({refreshing: false});
                            }, 1000)
                        }}
                    />}>
                <ListContent
                    index={conent}
                    title={conent}
                    content={conent}
                    agreeNumber={conent}
                    commentNumber={conent}/>
                <ListContent
                    index={2}
                    title={conent}
                    content={conent}
                    agreeNumber={conent}
                    commentNumber={conent}/>
                <ListContent
                    index={3}
                    title={conent}
                    content={conent}
                    agreeNumber={conent}
                    commentNumber={conent}/>
                <ListContent
                    index={4}
                    title={conent}
                    content={conent}
                    agreeNumber={conent}
                    commentNumber={conent}/><ListContent
                index={5}
                title={conent}
                content={conent}
                agreeNumber={conent}
                commentNumber={conent}/>

            </ScrollView>
        )

    }


}


export default class Recommend extends Component {
    constructor(props) {
        super(props);
    }

    render() {
        const tabs2 = [
            {title: '推荐'},
            {title: '关注'},
            {title: '热榜'},
            {title: '话题'},
            {title: '专家讲堂'},
        ];
        const style = {
            alignItems: 'center',
            justifyContent: 'center',
            height: 30,
            backgroundColor: '#fff',
        };
        return (
            <View style={{flex: 1}}>
                <View style={{flex: 1}}>
                    <Tabs tabs={tabs2} initialPage={1} tabBarPosition="top">
                        {(tab, index) => <RenderContent tab={tab} index={index}/>}
                    </Tabs>
                </View>
            </View>
        );
    }
}
